Quantitative analysis

Chris Moreh, 2023

Week 2

Revisiting Flatland

A review of general linear models

Guessing game

  [1] 151.7650 139.7000 136.5250 156.8450 145.4150 163.8300 149.2250 168.9100
  [9] 147.9550 165.1000 154.3050 151.1300 144.7800 149.9000 150.4950 163.1950
 [17] 157.4800 143.9418 121.9200 105.4100  86.3600 161.2900 156.2100 129.5400
 [25] 109.2200 146.4000 148.5900 147.3200 137.1600 125.7300 114.3000 147.9550
 [33] 161.9250 146.0500 146.0500 152.7048 142.8750 142.8750 147.9550 160.6550
 [41] 151.7650 162.8648 171.4500 147.3200 147.9550 144.7800 121.9200 128.9050
 [49]  97.7900 154.3050 143.5100 146.7000 157.4800 127.0000 110.4900  97.7900
 [57] 165.7350 152.4000 141.6050 158.8000 155.5750 164.4650 151.7650 161.2900
 [65] 154.3050 145.4150 145.4150 152.4000 163.8300 144.1450 129.5400 129.5400
 [73] 153.6700 142.8750 146.0500 167.0050 158.4198  91.4400 165.7350 149.8600
 [81] 147.9550 137.7950 154.9400 160.9598 161.9250 147.9550 113.6650 159.3850
 [89] 148.5900 136.5250 158.1150 144.7800 156.8450 179.0700 118.7450 170.1800
 [97] 146.0500 147.3200 113.0300 162.5600 133.9850 152.4000 160.0200 149.8600
[105] 142.8750 167.0050 159.3850 154.9400 148.5900 111.1250 111.7600 162.5600
[113] 152.4000 124.4600 111.7600  86.3600 170.1800 146.0500 159.3850 151.1300
[121] 160.6550 169.5450 158.7500  74.2950 149.8600 153.0350  96.5200 161.9250
[129] 162.5600 149.2250 116.8400 100.0760 163.1950 161.9250 145.4150 163.1950
[137] 151.1300 150.4950 141.6050 170.8150  91.4400 157.4800 152.4000 149.2250
[145] 129.5400 147.3200 145.4150 121.9200 113.6650 157.4800 154.3050 120.6500
[153] 115.6000 167.0050 142.8750 152.4000  96.5200 160.0000 159.3850 149.8600
[161] 160.6550 160.6550 149.2250 125.0950 140.9700 154.9400 141.6050 160.0200
[169] 150.1648 155.5750 103.5050  94.6150 156.2100 153.0350 167.0050 149.8600
[177] 147.9550 159.3850 161.9250 155.5750 159.3850 146.6850 172.7200 166.3700
[185] 141.6050 142.8750 133.3500 127.6350 119.3800 151.7650 156.8450 148.5900
[193] 157.4800 149.8600 147.9550 102.2350 153.0350 160.6550 149.2250 114.3000
[201] 100.9650 138.4300  91.4400 162.5600 149.2250 158.7500 149.8600 158.1150
[209] 156.2100 148.5900 143.5100 154.3050 131.4450 157.4800 157.4800 154.3050
[217] 107.9500 168.2750 145.4150 147.9550 100.9650 113.0300 149.2250 154.9400
[225] 162.5600 156.8450 123.1900 161.0106 144.7800 143.5100 149.2250 110.4900
[233] 149.8600 165.7350 144.1450 157.4800 154.3050 163.8300 156.2100 153.6700
[241] 134.6200 144.1450 114.3000 162.5600 146.0500 120.6500 154.9400 144.7800
[249] 106.6800 146.6850 152.4000 163.8300 165.7350 156.2100 152.4000 140.3350
[257] 158.1150 163.1950 151.1300 171.1198 149.8600 163.8300 141.6050  93.9800
[265] 149.2250 105.4100 146.0500 161.2900 162.5600 145.4150 145.4150 170.8150
[273] 127.0000 159.3850 159.4000 153.6700 160.0200 150.4950 149.2250 127.0000
[281] 142.8750 142.1130 147.3200 162.5600 164.4650 160.0200 153.6700 167.0050
[289] 151.1300 147.9550 125.3998 111.1250 153.0350 139.0650 152.4000 154.9400
[297] 147.9550 143.5100 117.9830 144.1450  92.7100 147.9550 155.5750 150.4950
[305] 155.5750 154.3050 130.6068 101.6000 157.4800 168.9100 150.4950 111.7600
[313] 160.0200 167.6400 144.1450 145.4150 160.0200 147.3200 164.4650 153.0350
[321] 149.2250 160.0200 149.2250  85.0900  84.4550  59.6138  92.7100 111.1250
[329]  90.8050 153.6700  99.6950  62.4840  81.9150  96.5200  80.0100 150.4950
[337] 151.7650 140.6398  88.2650 158.1150 149.2250 151.7650 154.9400 123.8250
[345] 104.1400 161.2900 148.5900  97.1550  93.3450 160.6550 157.4800 167.0050
[353] 157.4800  91.4400  60.4520 137.1600 152.4000 152.4000  81.2800 109.2200
[361]  71.1200  89.2048  67.3100  85.0900  69.8500 161.9250 152.4000  88.9000
[369]  90.1700  71.7550  83.8200 159.3850 142.2400 142.2400 168.9100 123.1900
[377]  74.9300  74.2950  90.8050 160.0200  67.9450 135.8900 158.1150  85.0900
[385]  93.3450 152.4000 155.5750 154.3050 156.8450 120.0150 114.3000  83.8200
[393] 156.2100 137.1600 114.3000  93.9800 168.2750 147.9550 139.7000 157.4800
[401]  76.2000  66.0400 160.7000 114.3000 146.0500 161.2900  69.8500 133.9850
[409]  67.9450 150.4950 163.1950 148.5900 148.5900 161.9250 153.6700  68.5800
[417] 151.1300 163.8300 153.0350 151.7650 132.0800 156.2100 140.3350 158.7500
[425] 142.8750  84.4550 151.9428 161.2900 127.9906 160.9852 144.7800 132.0800
[433] 117.9830 160.0200 154.9400 160.9852 165.9890 157.9880 154.9400  97.9932
[441]  64.1350 160.6550 147.3200 146.7000 147.3200 172.9994 158.1150 147.3200
[449] 124.9934 106.0450 165.9890 149.8600  76.2000 161.9250 140.0048  66.6750
[457]  62.8650 163.8300 147.9550 160.0200 154.9400 152.4000  62.2300 146.0500
[465] 151.9936 157.4800  55.8800  60.9600 151.7650 144.7800 118.1100  78.1050
[473] 160.6550 151.1300 121.9200  92.7100 153.6700 147.3200 139.7000 157.4800
[481]  91.4400 154.9400 143.5100  83.1850 158.1150 147.3200 123.8250  88.9000
[489] 160.0200 137.1600 165.1000 154.9400 111.1250 153.6700 145.4150 141.6050
[497] 144.7800 163.8300 161.2900 154.9000 161.3000 170.1800 149.8600 123.8250
[505]  85.0900 160.6550 154.9400 106.0450 126.3650 166.3700 148.2852 124.4600
[513]  89.5350 101.6000 151.7650 148.5900 153.6700  53.9750 146.6850  56.5150
[521] 100.9650 121.9200  81.5848 154.9400 156.2100 132.7150 125.0950 101.6000
[529] 160.6550 146.0500 132.7150  87.6300 156.2100 152.4000 162.5600 114.9350
[537]  67.9450 142.8750  76.8350 145.4150 162.5600 156.2100  71.1200 158.7500


What is the Mean of this dataset? What is its standard deviation?

Revised guesses

  • The data consist of 544 measurements of human height
  • The mean of the data is 138.2635963
  • The standard deviation is 27.6024476

!Kung demography

y <- tibble(y)
ggplot(y, aes(x = y)) + 
  geom_histogram() + scale_x_continuous(n.breaks = 20) + scale_y_continuous(n.breaks = 10)

     height           weight            age             male       
 Min.   : 53.98   Min.   : 4.252   Min.   : 0.00   Min.   :0.0000  
 1st Qu.:125.09   1st Qu.:22.008   1st Qu.:12.00   1st Qu.:0.0000  
 Median :148.59   Median :40.058   Median :27.00   Median :0.0000  
 Mean   :138.26   Mean   :35.611   Mean   :29.34   Mean   :0.4724  
 3rd Qu.:157.48   3rd Qu.:47.209   3rd Qu.:43.00   3rd Qu.:1.0000  
 Max.   :179.07   Max.   :62.993   Max.   :88.00   Max.   :1.0000  

Call:
lm(formula = height ~ weight, data = howell)

Residuals:
     Min       1Q   Median       3Q      Max 
-28.9634  -5.7794   0.7503   6.7207  20.7799 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  75.4359     1.0517   71.72   <2e-16 ***
weight        1.7643     0.0273   64.63   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 9.363 on 542 degrees of freedom
Multiple R-squared:  0.8851,    Adjusted R-squared:  0.8849 
F-statistic:  4177 on 1 and 542 DF,  p-value: < 2.2e-16

Call:
lm(formula = height ~ weight + age + male, data = howell)

Residuals:
    Min      1Q  Median      3Q     Max 
-29.011  -5.409   0.730   6.490  19.735 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 75.94238    1.06471  71.327  < 2e-16 ***
weight       1.65634    0.03740  44.289  < 2e-16 ***
age          0.11247    0.02621   4.291 2.11e-05 ***
male         0.07931    0.80942   0.098    0.922    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 9.222 on 540 degrees of freedom
Multiple R-squared:  0.889, Adjusted R-squared:  0.8884 
F-statistic:  1441 on 3 and 540 DF,  p-value: < 2.2e-16